package com.zh.kotlin_mvvm.ui

import android.os.Bundle
import com.zh.common.base.BaseActivity
import com.zh.common.ktx.clickSingleListener
import com.zh.kotlin_mvvm.R
import com.zh.kotlin_mvvm.databinding.ActivityGtactivityBinding
import com.zh.common.update.NotificationUtils


/**
 * github: https://blog.csdn.net/qq_39799899/article/details/127001248
 */
class GTActivity : BaseActivity<ActivityGtactivityBinding>() {

    private var progress = 0

    override fun initView(savedInstanceState: Bundle?) {
        viewBinding.tvFloating.clickSingleListener {
            progress = 0
            NotificationUtils.instance.createNotificationForProgress(this, R.mipmap.logo)
        }
        viewBinding.tvLocal.clickSingleListener {
            progress += 1
            if (progress > 100) return@clickSingleListener
            NotificationUtils.instance.updateNotificationForProgress(progress)
        }

        viewBinding.tvItem2.setOnClickListener {
            NotificationUtils.instance.createNotificationForNormal(
                this,
                R.mipmap.logo,
                MainActivity::class.java
            )
        }
    }
}